# ANSI color codes
class Colors:
    RED = "\033[91m"
    GREEN = "\033[92m"
    YELLOW = "\033[93m"
    BLUE = "\033[94m"
    PURPLE = "\033[95m"
    CYAN = "\033[96m"
    WHITE = "\033[97m"
    ENDC = "\033[0m"  # End color


class Logger:
    """Logger class for unified handling of different level log outputs"""

    prefix = ""

    @staticmethod
    def begin_section(section_name):
        """开始一个新的日志段落"""
        Logger.prefix = "├────── "
        print(f"┌────── {section_name} " + "─" * (80 - 8 - len(section_name)))

    @staticmethod
    def end_section():
        """结束当前日志段落"""
        Logger.prefix = ""
        print(f"└" + "─" * 80)

    @staticmethod
    def info(message):
        """Info log"""
        print(f"{Logger.prefix}{Colors.CYAN}{message}{Colors.ENDC}")

    @staticmethod
    def success(message):
        """Success log"""
        print(f"{Logger.prefix}{Colors.GREEN}✅ {message}{Colors.ENDC}")

    @staticmethod
    def warning(message):
        """Warning log"""
        print(f"{Logger.prefix}{Colors.YELLOW}⚠️  {message}{Colors.ENDC}")

    @staticmethod
    def error(message):
        """Error log"""
        print(f"{Logger.prefix}{Colors.RED}❌ {message}{Colors.ENDC}")
